﻿<!-- application/views/script/paging.phtml-->
<?php if($this->pages['totalpage'] > 1) { ?>  
    <Table width="98%" align="center">  
        <tr>  
            <td>  
            <?php 
			echo "总".$this->pages['totalpage']."页/".$this->pages['total']."条记录  ";
            echo "<a href='".$this->pages['url']."page/1'>&lt;&lt;首页</a>"; 
			if($this->pages['curpage'] > 1) { 
                echo "&nbsp;<a href='".$this->pages['url']."page/". ($this->pages['curpage']-1). "' >&nbsp;&lt;上一页</a>"; 
			}
			echo "&nbsp;|&nbsp;";
			
			for($i=1; $i<= $this->pages['totalpage']; $i++ ) {
				//show only 5 + 5 + 1 pages
				if ($i < ($this->pages['curpage'] - 5) || $i > ($this->pages['curpage'] + 5)) {
					continue;
				}
				if($this->pages['curpage'] == $i) { 
					echo "<em><b>".$i."</b></em>"; 
				} else {  
					echo "<a href='".$this->pages['url']. "page/".$i."/'>".$i."</a>";
				} 
				echo "&nbsp;|&nbsp;";
			} 
			if($this->pages['curpage'] < $this->pages['totalpage']) {
                echo "<a href='".$this->pages['url']."page/". ($this->pages['curpage']+1). "' >下一页&gt;</a>&nbsp;"; 
            }
			echo "<a href='".$this->pages['url']."page/". ($this->pages['totalpage']). "' >末页&gt;&gt;</a>"; 
            
			?>  
            </td>  
        </tr>  
    </Table>  
<?php } ?> 